/*
 * servo.h
 *
 *  Created on: Jun 21, 2010
 *      Author: static
 */
#include <stdlib.h>

#ifndef SERVO_H_
#define SERVO_H_

/*####### Comment out as you see fit #######*/
#define SERVOSTEP 9 // Position in steps
#define HALFSERVOSTEP 5 // Position in steps

//#define FULLRIGHT 1181 // Position in steps
//#define FULLLEFT 4633 // Position in steps

//#define FULLRIGHT 1106
//#define FULLLeft 4337
/*####### Define Comment block </end> #######*/

/* typedef struct servoPos.
 * Used to handle the servo functionality
 * in a shared memory space. All angles are
 * assuming the full right servo is at 0
 * degrees and the left is 180 degrees.
 * These values can be either programmed in
 * or use a calibration function.
 */
typedef struct servoPos{
	unsigned int cPos; // Current position
	unsigned int fullRight; // 0 degrees
	unsigned int fullLeft; // 180 degrees
	unsigned int nPos; // New Position
	unsigned int sStep; // Counts between 1 degree steps
}servoPos;

void servoPos_init(servoPos*);
void servoPos_Cal(servoPos*);
void servoPos_moveWait(int finish,servoPos*);
void servoPos_servoSweep(int start,int finish,servoPos*);

#endif /* SERVO_H_ */
